package dao;

import tool.Util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DisposeGroupDao {
    Util util = new Util();
    Connection connection = null;

    public void disposeGroup(String username, String groupName) {
        connection = util.getConnection();
        String sql = "update group_chat set status=1 where username=? and name=?";
        try {
            PreparedStatement preparedStatement = connection.prepareStatement(sql);
            preparedStatement.setString(1, username);
            preparedStatement.setString(2, groupName);
            preparedStatement.executeUpdate();
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
